//
//  WorkflowInfo.h
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 2017/8/23.
//  Copyright © 2017年 com.xtion.crm. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "WorkAppInfo.h"

#define ProcessName @"processname"
#define ProcessCode @"processcode"
#define InstanceId @"instanceid"
#define CustomForm @"customform"
#define Version @"version"

#define WfFinishFlag @"结束"

#define SplitCommaString @","

@interface WorkflowInfo : NSObject<NSCopying,XLGJSONOjectMapDelegate,XMSTableColumnMapDelegate>

@property(nonatomic,strong) NSString *name;
@property(nonatomic,strong) NSString *icon;
@property(nonatomic,strong) NSString *mobileType;
@property(nonatomic,strong) NSString *className;
@property(nonatomic,strong) NSString *processGUID;
@property(nonatomic,strong) NSString *processName;
@property(nonatomic,strong) NSString *version;
@property(nonatomic,strong) NSString *processCode;
@property(nonatomic,strong) NSString *customFormID;
@property(nonatomic,strong) XMSNumberInt *allCount;
@property(nonatomic,strong) XMSNumberInt *toDoCount;
@property(nonatomic,strong) XMSNumberInt *rowNumber;

+(WorkflowInfo*)emptyWorkflowInfo;
@end 

@interface WorkflowAllListInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) XMSNumberInt *dataId;
@property(nonatomic,strong) NSString *processGUID;
@property(nonatomic,strong) NSString *processName;
@property(nonatomic,strong) NSString *version;
@property(nonatomic,strong) NSString *appInstanceID;
@property(nonatomic,strong) NSString *appName;
@property(nonatomic,strong) NSString *appInstanceCode;
@property(nonatomic,strong) XMSNumberInt *processState;
@property(nonatomic,strong) NSString *parentProcessInstanceID;
@property(nonatomic,strong) NSString *parentProcessGUID;
@property(nonatomic,strong) XMSNumberInt *invokedActivityInstanceID;
@property(nonatomic,strong) NSString *invokedActivityGUID;

@property(nonatomic,strong) NSDate *createdDateTime;
@property(nonatomic,strong) NSString *createdByUserID;
@property(nonatomic,strong) NSString *createdByUserName;

@property(nonatomic,strong) NSDate *lastUpdatedDateTime;
@property(nonatomic,strong) NSString *lastUpdatedByUserID;
@property(nonatomic,strong) NSString *lastUpdatedByUserName;

@property(nonatomic,strong) NSDate *endedDateTime;
@property(nonatomic,strong) NSString *endedByUserID;
@property(nonatomic,strong) NSString *endedByUserName;

@property(nonatomic,strong) XMSNumberInt *recordStatusInvalid;
@property(nonatomic,strong) NSString *rowVersionID;
@property(nonatomic,strong) NSString *createdByDept;
@property(nonatomic,strong) NSString *processCode;
@property(nonatomic,strong) NSString *customFormID;
@property(nonatomic,strong) XMSNumberInt *rowNumber;

@property(nonatomic,strong) NSArray *dateList;

@end

@interface WorkflowToDoListInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSString *customFormID;
@property(nonatomic,strong) NSString *processCode;
@property(nonatomic,strong) XMSNumberInt *taskID;
@property(nonatomic,strong) NSString *appName;
@property(nonatomic,strong) NSString *appInstanceID;
@property(nonatomic,strong) NSString *processGUID;
@property(nonatomic,strong) NSString *version;
@property(nonatomic,strong) XMSNumberInt *processInstanceID;

@property(nonatomic,strong) NSString *activityGUID;
@property(nonatomic,strong) XMSNumberInt *activityInstanceID;
@property(nonatomic,strong) NSString *activityName;
@property(nonatomic,strong) XMSNumberInt *activityType;
@property(nonatomic,strong) XMSNumberInt *workItemType;

@property(nonatomic,strong) NSString *previousUserID;
@property(nonatomic,strong) NSString *previousUserName;
@property(nonatomic,strong) NSDate *previousDateTime;

@property(nonatomic,strong) XMSNumberInt *taskType;
@property(nonatomic,strong) XMSNumberInt *entrustedTaskID;

@property(nonatomic,strong) NSString *assignedToUserID;
@property(nonatomic,strong) NSString *assignedToUserName;
@property(nonatomic,strong) NSDate *createdDateTime;
@property(nonatomic,strong) NSDate *lastUpdatedDateTime;

@property(nonatomic,strong) NSDate *endedDateTime;
@property(nonatomic,strong) NSString *endedByUserID;
@property(nonatomic,strong) NSString *endedByUserName;

@property(nonatomic,strong) XMSNumberInt *taskState;
@property(nonatomic,strong) XMSNumberInt *activityState;
@property(nonatomic,strong) XMSNumberInt *recordStatusInvalid;
@property(nonatomic,strong) XMSNumberInt *processState;
@property(nonatomic,strong) XMSNumberInt *complexType;

@property(nonatomic,strong) NSString *mIHostActivityInstanceID;
@property(nonatomic,strong) NSString *appInstanceCode;
@property(nonatomic,strong) NSString *processName;

@property(nonatomic,strong) NSString *createdByUserID;
@property(nonatomic,strong) NSDate *pCreatedDateTime;
@property(nonatomic,strong) NSString *createdByUserName;

@property(nonatomic,strong) XMSNumberInt *miHostState;
@property(nonatomic,strong) NSString *createdByDept;
@property(nonatomic,strong) XMSNumberInt *rowNumber;
@end

@interface WorkflowDateListInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSDate *createdDateTime;
@property(nonatomic,strong) NSString *processCode;
@property(nonatomic,strong) XMSNumberInt *rowNumber;

@end

//workflow apply
@class WorkflowPermissionInfo;
@interface WorkflowApplyInfo : NSObject

@property(nonatomic,strong) CustomerFormInfo *customForm;
@property(nonatomic,strong) NSArray *fields;
@property(nonatomic,strong) NSArray *activityFields;
@property(nonatomic,strong) NSArray *fieldConfigItems;

@property(nonatomic,strong) NSString *processGUID;
@property(nonatomic,strong) NSString *version;
@property(nonatomic,strong) NSString *processName;

@property(nonatomic,strong) NSArray *nextActionNames;

//approve
@property(nonatomic,strong) NSDictionary *modelValue;
@property(nonatomic,assign) BOOL isMyPendingTask;
@property(nonatomic,strong) WorkflowPermissionInfo *permission;
@property(nonatomic,strong) NSArray *attachments;

@end

//workflow select user
@interface WorkflowUserInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSString *userID;
@property(nonatomic,strong) NSString *userName;

@end

@interface WorkflowParticipantInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSString *type;
@property(nonatomic,strong) NSString *typeId;
@property(nonatomic,strong) NSString *name;
@property(nonatomic,strong) NSString *code;
@property(nonatomic,strong) NSString *outerID;
@property(nonatomic,strong) NSArray *users;

@end

@interface WorkflowUserEntityInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSString *activityGUID;
@property(nonatomic,strong) NSString *activityName;
@property(nonatomic,strong) NSArray *participants;
@property(nonatomic,assign) BOOL isSkipTo;
@property(nonatomic,strong) XMSNumberInt *receiverType;

@end

@interface WorkflowSelectUserInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) XMSNumberInt *status;
@property(nonatomic,strong) NSString *message;
@property(nonatomic,strong) NSArray *entity;

@end

@interface WorkflowPermissionInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSString *currentActivityName;
@property(nonatomic,assign) BOOL approve;
@property(nonatomic,assign) BOOL withdrawProcess;
@property(nonatomic,assign) BOOL sendBackProcess;
@property(nonatomic,assign) BOOL discardProcess;
@property(nonatomic,assign) BOOL reverseProcess;
@property(nonatomic,strong) NSArray *nextActionNames;
@property(nonatomic,assign) BOOL signTogether;

@end

@interface WorkflowAttachmentInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) NSString *attachmentId;
@property(nonatomic,strong) NSString *modelID;
@property(nonatomic,strong) XMSNumberInt *subType;
@property(nonatomic,strong) NSString *fielFullName;
@property(nonatomic,strong) NSString *filePreName;
@property(nonatomic,strong) NSString *fileExtension;
@property(nonatomic,strong) XMSNumberInt *fileSize;
@property(nonatomic,strong) NSString *fileFolder;
@property(nonatomic,strong) XMSNumberInt *status;
@property(nonatomic,strong) NSString *refferURL;
@property(nonatomic,strong) XMSNumberInt *createUserId;

@property(nonatomic,strong) NSDate *createDate;

@end

//workflow histiry
@interface WorkflowHistoryInfo : NSObject<XLGJSONOjectMapDelegate>

@property(nonatomic,strong) XMSNumberInt *historyId;
@property(nonatomic,strong) NSString *appName;
@property(nonatomic,strong) NSString *apInstanceID;
@property(nonatomic,strong) NSString *appInstanceCode;
@property(nonatomic,strong) XMSNumberInt *status;
@property(nonatomic,strong) NSString *activityName;
@property(nonatomic,strong) XMSNumberInt *remark;
@property(nonatomic,strong) NSDate *changedTime;
@property(nonatomic,strong) NSString *changedUserID;
@property(nonatomic,strong) NSString *changedUserName;

@end

typedef NS_ENUM(NSUInteger,PermissionType)
{
    PermissionTypeNone,
    PermissionTypeAgree,
    PermissionTypeWithdraw,
    PermissionTypeSendBack,
    PermissionTypeDiscard,
    PermissionTypeReverse,
};

typedef NS_ENUM(NSUInteger,WorkflowOptType)
{
    WorkflowOptTypeApply,
    WorkflowOptTypeAudit,
};
